<?php

/**
 * 店铺消息阅读模板模型
 */

namespace app\common\model;

use think\Db;

class StoreMsgRead extends \think\Model
{
    /**
     * 新增店铺纤细阅读
     * @param unknown $insert
     */
    public function addStoreMsgRead($insert)
    {
        $insert['read_time'] = TIMESTAMP;
        return Db::name('store_msg_read')->insert($insert, false, true);
    }

    /**
     * 查看店铺消息阅读详细
     * @param unknown $condition
     * @param string $field
     */
    public function getStoreMsgReadInfo($condition, $field = '*')
    {
        return Db::name('store_msg_read')->field($field)->where($condition)->find();
    }

    /**
     * 店铺消息阅读列表
     * @param unknown $condition
     * @param string $field
     * @param string $order
     */
    public function getStoreMsgReadList($condition, $field = '*', $order = 'read_time desc')
    {
        return Db::name('store_msg_read')->field($field)->where($condition)->order($order)->select();
    }

    /**
     * 删除店铺消息阅读记录
     * @param unknown $condition
     */
    public function delStoreMsgRead($condition)
    {
        return Db::name('store_msg_read')->where($condition)->delete();
    }

}
